package com.salt.client.config;

import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author salt
 * @Date 2022/10/19
 * @Version 1.0.1
 */
@Configuration
public class ServletConfig {

    @Bean
    public ServletWebServerFactory mbeddedServletContainerFactory() {
        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory ();
        tomcat.addConnectorCustomizers(connector ->{
            connector.setMaxParameterCount(Integer.MAX_VALUE);
        });
        //tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
        return tomcat;
    }

    /*private Connector createHTTPConnector() {
        Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
        //同时启用http（9100）、https（9200）两个端口
        connector.setScheme("http");
        connector.setSecure(false);
        connector.setPort(9100);  // http
        connector.setRedirectPort(9200);  // https
        return connector;
    }*/

}
